package com.gc.server.dao;

import com.gc.server.entity.TodoEntity;
import com.gc.server.entity.UserEntity;
import com.gc.server.vo.TodoVo;
import com.gc.server.vo.UserVo;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.Mapper;
import com.yf.dao.BaseDao;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 用户Dao
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Tue Mar 10 11:17:45 CST 2020
 */
@Mapper
public interface UserDao extends BaseDao<UserEntity> {

    UserEntity findByOpenId(String openId);

    UserEntity findByCode(String code);

    UserEntity findByMobile(String mobile);

    List<UserEntity> findByPid(Long pid);

    //替换团队
    void updateTeam(@Param("oldTCode") String oldTCode, @Param("nowTCode") String nowTCode, @Param("oldTeam") String oldTeam, @Param("nowTeam") String nowTeam);

    // 通过上家与级别查找
    List<UserEntity> findMyShopUserAndLevel(@Param("topId") Long topId, @Param("levelId") Long levelId);


    List<UserVo> queryListVo(UserVo userVo);

    UserVo getVo(Long id);

    /**
     * 找到某天某人新增的用户
     * @param pid
     * @param date
     * @return
     */
    List<UserEntity> findByPidAndDate(@Param("pid") Long pid, @Param("date") Date date);

    UserEntity findByWxId(String wxId);

    List<UserEntity> findMyShopUsers(@Param("ids") List<Long> ids);


    List<UserEntity> findByIds(List<Long> ids);

    List<UserEntity> sumByTop(Long userId);
}
